﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Web.Security;

public partial class biz_login : FBasePage
{


    // Methods
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
    }

    protected void submit_ServerClick(object sender, EventArgs e)
    {
        string str = base.Request.Form["username"].ToString().Trim();
        string str2 = base.Request.Form["password"].ToString().Trim();
        string strWhere = "";
        if (str == "")
        {
            this.SetError("请输入用户名！");
            base.Response.Redirect("login.aspx");
        }
        if (str2 == "")
        {
            this.SetError("请输入用户密码！");
            base.Response.Redirect("login.aspx");
        }
        strWhere = string.Format(" Username='{0}'", str, str);
        DataSet list = new Maticsoft.BLL.Partner().GetList(strWhere);
        if ((list != null) && (list.Tables.Count > 0))
        {
            if (list.Tables[0].Rows.Count > 0)
            {
                if (list.Tables[0].Rows[0]["Password"].ToString() == FormsAuthentication.HashPasswordForStoringInConfigFile(str2 + "@4!@#$%@", "md5"))
                {
                    string msg = list.Tables[0].Rows[0]["ID"].ToString();
                    base.SetCookie("partnerid", msg);
                    base.Response.Redirect("index.aspx");
                }
                else
                {
                    this.SetError("你输入的密码错误！");
                    base.Response.Redirect("login.aspx");
                }
            }
            else
            {
                this.SetError("该用户不存在！");
                base.Response.Redirect("login.aspx");
            }
        }
    }

}